import itf from '../utils/interface.js'

export default function useLogout() {
  function clear() {
    try {
      itf.setStorageSync('tenant', undefined)
      itf.setStorageSync('token', undefined)
      itf.setStorageSync('session', undefined)
      itf.setStorageSync('openId', undefined)
      itf.setStorageSync('password', {
        value: '',
        expiry: '',
      })

      return true
    } catch (err) {
      return false
    }
  }

  return {
    clear,
  }
}